package com.gexiaobao.pigeon.ui.dialog

import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.appcompat.widget.AppCompatEditText
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import com.gexiaobao.pigeon.R

/**
 * @Author      : hxw
 * @Date        : 2024/5/8 10:58
 * @Describe    :
 */
class RxEtInputDialog(context: Context?) : RxDialog(context!!) {

    private lateinit var cancelView: AppCompatImageView
    private lateinit var tvNewAgentCancel: AppCompatTextView
    private lateinit var tvNewAgentSure: AppCompatTextView
    private lateinit var etAgentName: AppCompatEditText
    private lateinit var etAgentAddress: AppCompatEditText
    private lateinit var etAgentMobile: AppCompatEditText

    init {
        initView()
    }

    @SuppressLint("MissingInflatedId")
    private fun initView() {
        val dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_new_agent, null)
        tvNewAgentCancel = dialogView.findViewById(R.id.tvNewAgentDialogCancel)
        tvNewAgentSure = dialogView.findViewById(R.id.tvNewAgentDialogSure)
        cancelView = dialogView.findViewById(R.id.cancelView)
        etAgentName = dialogView.findViewById(R.id.etNewAgentName)
        etAgentAddress = dialogView.findViewById(R.id.etNewAgentAddress)
        etAgentMobile = dialogView.findViewById(R.id.etNewAgentMobile)

        cancelView.setOnClickListener {
            dismiss()
        }
        tvNewAgentCancel.setOnClickListener {
            dismiss()
        }
        setContentView(dialogView)
    }

    fun setSureListener(listener: View.OnClickListener?) {
        tvNewAgentSure.setOnClickListener(listener)
    }

    fun getAgentName(): String {
        return etAgentName.text.toString().trim()
    }

    fun getAgentAddress(): String {
        return etAgentAddress.text.toString().trim()
    }

    fun getAgentMobile(): String {
        return etAgentMobile.text.toString().trim()
    }
}